package com.situ.domain;

import java.io.Serializable;

public class Car implements Comparable<Car>, Serializable {
    /** serialVersionUID*/  
    private static final long serialVersionUID = 165464646L;
    
    private String lisence;
    private double high;

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        long temp;
        temp = Double.doubleToLongBits(high);
        result = prime * result + (int) (temp ^ (temp >>> 32));
        result = prime * result + ((lisence == null) ? 0 : lisence.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Car other = (Car) obj;
        if (Double.doubleToLongBits(high) != Double.doubleToLongBits(other.high))
            return false;
        if (lisence == null) {
            if (other.lisence != null)
                return false;
        } else if (!lisence.equals(other.lisence))
            return false;
        return true;
    }

    @Override
    public int compareTo(Car car) {
        return this.high != car.getHigh() ? 1 : 0;
    }

    @Override
    public String toString() {
        return lisence + "\t" + high;
    }

    // 构造器
    public Car() {
        super();
    }

    public Car(String lisence, double high) {
        super();
        this.lisence = lisence;
        this.high = high;
    }

    // getter setter
    public String getLisence() {
        return lisence;
    }

    public void setLisence(String lisence) {
        this.lisence = lisence;
    }

    public double getHigh() {
        return high;
    }

    public void setHigh(double high) {
        this.high = high;
    }

}
